﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucOrderView.ascx.cs" Inherits="MyWeb.Admin.Usercontrols.ucOrderView" %>
<div id="page-content">
    <div id="page-header">
        <h1>
            <asp:Label ID="lblPageHeader" runat="server" Text="Đơn hàng"></asp:Label></h1>
    </div>
    <div class="container">
        <div class="box-header">
            <div style="text-align: left">
                <asp:Button ID="btnDelete" CssClass="button" runat="server" Text="Xóa" OnClientClick=" return confirm('Bạn có chắc chắn muốn xóa không?') " OnClick="btnDelete_Click" />
                <asp:DropDownList ID="ddlUser" runat="server" Width="200px">
                </asp:DropDownList>
            </div>
        </div>
        <div class="box table">
            <asp:GridView ID="gvData" CellPadding="0" Width="100%" CssClass="GridStyle" AutoGenerateColumns="False" AllowPaging="True" DataKeyNames="Id" runat="server" OnPageIndexChanging="gvData_PageIndexChanging">
                <Columns>
                    <asp:TemplateField>
                        <HeaderStyle Width="5%"></HeaderStyle>
                        <ItemStyle CssClass="cbxCheck" HorizontalAlign="Center"></ItemStyle>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        <HeaderTemplate>
                            <asp:CheckBox ID="chckAll" onclick="CheckUncheckAll;"
                                          runat="server" ToolTip="Bỏ / Chọn hết" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chckSelect" runat="server" onclick="ChangeHeaderAsNeeded('chckSelect','chckAll',$(this));" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Khách hàng">
                        <HeaderStyle Width="15%"></HeaderStyle>
                        <ItemTemplate>
                            <asp:HiddenField ID="hdID" Value='<%#Eval("id") %>' runat="server" />
                          <a href="View.aspx?action=ucOrderAddUpdate&in=2&id=<%#Eval("id") %>"><%#Eval("user_id") %></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="totalmoney" HeaderText="Tổng tiền"></asp:BoundField>
                    <asp:BoundField DataField="date" HeaderText="Ngày" DataFormatString="{0:MM/dd/yyyy}"></asp:BoundField>
                     <asp:TemplateField HeaderText="Trạng thái">
                        <HeaderStyle Width="10%"></HeaderStyle>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="lbtStatus" CommandArgument='<%#Eval("id") %>' CommandName="Status" Text='<%#(Int32.Parse(Eval("Status").ToString())==0) ? "Công bố" : "Hạn chế" %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="GridTitle" />
                <RowStyle CssClass="RowStyle" />
                <AlternatingRowStyle CssClass="AlternateRowStyle" />
                <EmptyDataRowStyle HorizontalAlign="Center" />
                <PagerStyle CssClass="Paging" HorizontalAlign="Left" />
                <PagerSettings Mode="NumericFirstLast" />
                <EmptyDataTemplate>
                    <asp:Label ID="lblNoItem" runat="server" Text="Chưa có dữ liệu"></asp:Label>
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
    </div>
</div>

<script type="text/javascript">
   
    function CheckUncheckAll() {
        var i;
        CheckBoxs = document.getElementsByTagName("input");

        for (i = 0; i < CheckBoxs.length; i++) {
            if (CheckBoxs[i].type == "checkbox") CheckBoxs[i].checked = document.getElementById("chkAll").checked;
        }
    }

</script>